package cn.richard.demo.ruleengine.config;

import org.jeasy.rules.api.Facts;
import org.jeasy.rules.api.Rules;
import org.jeasy.rules.api.RulesEngineListener;

import cn.richard.demo.ruleengine.util.MyRulesUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MyRulesEngineListener implements RulesEngineListener {
	@Override
	public void beforeEvaluate(Rules rules, Facts facts) {
		log.info("beforeEvaluate, rules: {}, {}, facts: {}", MyRulesUtil.rulesMap(rules).size(),
				MyRulesUtil.rulesMap(rules).keySet(), facts.asMap());
	}

	@Override
	public void afterExecute(Rules rules, Facts facts) {
		log.info("afterExecute, rules: {}, {}, facts: {}", MyRulesUtil.rulesMap(rules).size(),
				MyRulesUtil.rulesMap(rules).keySet(), facts.asMap());
	}

}
